Name of contribution
====================
Info Admin Orders


Version
=======
v 1.0 24.10.2008 

Author
======
Luk Krchk <lukas.krchnak@uniqeweb.cz>
email: info@uniqueweb.cz
web: www.uniqueweb.cz


Licence
=======
GNU - GPL
This contribution is completely free:-)

Description
===========
This contribution is for quick overview of customers orders in Zencart admin panel.

Compatibility
=============
Compatible with Zen Cart v1.3.8.
http://www.zen-cart.com


Files to overwrite
==================
None.


Change in DB
============
None.


Disclaimer
==========
Installation of this contribution is done at your own risk!
Backup your ZenCart database and any and all applicable files before proceeding.

Features:
=========
- Showing detail of the orders in floating window
- Showing these items:	
			1) Quantity, kind and price of items
			2) Price with and without TAX and total price
			3) Telephone and mail of customer
			4) History of the order


Instalation / Ugrade:
===================
1. Upload the entire contents of the "admin" folder to your website. All directories are
   already named for you and there are no files to overwrite so it should be easy.
   NOTE: If you changed the name of your "admin" directory to something else, then upload
         to that directory. 

2. The zip file contains inside folder "orders" changed file "orders.php" from Zencart v1.3.8. 
   If you have this version you can simply overwrite your file and intalation is complete.
   Otherwise proceed as follows:

3. Manualy change file orders.php

Edit file admin/orders.php and add these lines:

3.1. search this line of code:

<body onLoad="init()">

and after that add these code:

<?php // ====> BOF: Info Admin Orders <==== ?>
<script type="text/javascript" src="includes/javascript/wz_tooltip.js"></script>
<?php // ====> EOF: Info Admin Orders <==== ?>

3.2. search this line of code:

<td class="dataTableHeadingContent" align="left" width="50"><?php echo TABLE_HEADING_PAYMENT_METHOD; ?></td>

<?php // ====> BOF: Info admin <==== ?>
<td class="dataTableHeadingContent">Info</td>
<?php // ====> EOF: Info admin <==== ?>

3.3. search this line of code:

<td class="dataTableContent" align="left" width="50"><?php echo $show_payment_type; ?></td>

a za nj pidejte tento kd:

<?php // ====> BOF: Info Admin Orders <==== ?>
<td class="dataTableContent" align="center"><b><?php 
  $order = new order($orders->fields['orders_id']);  

  $info_admin = '<table width= "550px" align="center" border="0" border-style="solid" cellspacing="0" cellpadding="2">'.
            '<tr>'.
            '<td class="smallText" align="center"><strong>'.TABLE_HEADING_QUANTITY.'</strong></td>'.
            '<td class="smallText" align="center" width="300px"><strong>'. TABLE_HEADING_PRODUCTS .'</strong></td>'.
            '<td class="smallText" align="center"><strong>'. TABLE_HEADING_TOTAL_INCLUDING_TAX .'</strong></td>'.
            '</tr>';
  for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
    $info_admin .= ' <tr>' . '\n' .
           '        <td class="smallText" valign="top" align="center">' . $order->products[$i]['qty'] . '&nbsp;x</td>' . '\n' .
           '        <td class="smallText" valign="top" align="center">' . $order->products[$i]['name'];

    $info_admin .= '</td>\n' .
                   '<td class="smallText" align="center" valign="top"><strong>' .
                   $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) .
                   ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format(zen_add_tax($order->products[$i]['onetime_charges'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) : '') .
                   '</strong></td>' . '\n';
    $info_admin .= '</tr>\n';
}
  $info_admin .= '<br>';
  for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) {
      $info_admin .= '<tr><td></td>\n' .
                     '<td align="right" class="smalltext">' . $order->totals[$i]['title'] . '</td>' . '\n' .
                     '<td align="center" class="smallText">' . $order->totals[$i]['text'] . '</td>' . '\n' .
                     '</tr>';
    }
  $info_admin .= '</tr></table><br><table align="center" border="0" border-style="solid" cellspacing="0" ><tr>'.
                 '<td class="smallText" align="center">'.ENTRY_TELEPHONE_NUMBER . ' ' . ($order->customer['telephone']). '</td></tr>'.
                 '<tr><td class="smallText" align="center">'.ENTRY_EMAIL_ADDRESS .' ' . ($order->customer['email_address']).'</td></tr></table>'.
                 '<table width="550px" align="center" border="0" border-style="solid" cellspacing="0" cellpadding="5">'.
                 '<tr>'.
                 '<td class="smallText" align="center"><strong>'.  TABLE_HEADING_DATE_ADDED .'</strong></td>'.
                 '<td class="smallText" align="center"><strong>'.  TABLE_HEADING_CUSTOMER_NOTIFIED.'</strong></td>'.
                 '<td class="smallText" align="center"><strong>'.  TABLE_HEADING_STATUS.'</strong></td>'.
                 '<td class="smallText" width="180px" align="center"><strong>'.  TABLE_HEADING_COMMENTS.'</strong></td>'.
                 '</tr>';
  $orders_history = $db->Execute("select orders_status_id, date_added, customer_notified, comments
                                  from " . TABLE_ORDERS_STATUS_HISTORY . "
                                  where orders_id = '" . zen_db_input($orders->fields['orders_id']) . "'
                                  order by date_added");
  if ($orders_history->RecordCount() > 0) {
      while (!$orders_history->EOF) {
        $info_admin .= '<tr><td class="smallText" align="center">'.    
               zen_datetime_short($orders_history->fields['date_added']) .'</td>\n';
        if ($orders_history->fields['customer_notified'] == '1') {
         $info_admin .= ' <td class="smallText" align="center"><img src=images/icons/tick.gif></td>\n';
        } else {
          $info_admin .= ' <td class="smallText" align="center"><img src=images/icons/cross.gif></td>\n';
        }
        $info_admin .=  ' <td class="smallText">' . $orders_status_array[$orders_history->fields['orders_status_id']] . '</td>' . '\n';
        $info_admin .=  '  <td class="smallText" >' . nl2br(zen_db_output($orders_history->fields['comments'])) . '&nbsp;</td>' . '\n' .
             '          </tr>' . '\n';
        $orders_history->MoveNext();
      }
    } else {
       $info_admin .=  '          <tr>' . "\n" .
             '            <td class="smallText" colspan="5">' . TEXT_NO_ORDER_HISTORY . '</td>' . "\n" .
             '          </tr>' . "\n";
    }

 $info_admin = htmlspecialchars ( $info_admin);
 { 
	$parsedComment = explode("\r", $info_admin);
	$cleanComment = "";
	$i=0;
	while($i < count($parsedComment)) {
	$cleanComment .= trim($parsedComment[$i]);
	$i++;
	if ($i < count($parsedComment)) $cleanComment .= '<br \> ';
}
       
?>	            
 <a href="javascript:void(0);" onmouseover="Tip('<?php echo $cleanComment; ?>', TITLE, '<?php echo ENTRY_CUSTOMER . ' ' . $orders->fields['customers_name']?>', WIDTH, 550, OPACITY, 90)" onmouseout="UnTip()"><img src="images/icons/comment2.gif" align="top" border=0></a>
<?php } ?></b></a>
<?php // ====> EOF: Info Admin Orders <==== ?>

Now is installation complete.

Uninstall
=========

1. To uninstall, delete each of the files you uploaded from this package.


How to use:
===========

1. From within the admin, go to Customers > Orders, 

2. There is a new column Info with icon, move the cursor over and the floating window will appear.

Version history
===============
v1.0.0 First version
------------------
